const express = require('express')
// 上传图片的库
const multer = require('multer')
const upload = multer({dest:'public/uploads'})

const admin_handler = require('../router_handler/admin_handler/admin_handler')
const admin_data = require('../router_handler/admin_handler/admin_data')
const admin_classes = require('../router_handler/admin_handler/admin_classes')
const admin_comment = require("../router_handler/admin_handler/admin_comment")

const router = express.Router()
// 注册和登录业务
router.post('/register',admin_handler.Register)
router.post('/login',admin_handler.Login)

// 获取数据接口
router.get('/asideList',admin_data.asideList)

router.get('/getDayBrowse',admin_data.getDayBrowse)

router.get('/getAllBrowse',admin_data.getAllBrowse)

// 课程分类相关
router.post('/addTextBook',upload.single('file'),admin_data.addTextBook)
router.post('/updateTextBook',upload.single('file'),admin_data.updateTextBook)
router.get('/getTextBook',admin_data.getTextBook)
router.post('/deleteTextBook',admin_data.deleteTextBook)
router.get('/searchTextBook',admin_data.searchTextBook)

// 课程相关接口
router.get('/getClassesData',admin_classes.getClassesData)

// 讨论相关接口
router.get('/getComment',admin_comment.getComment)
module.exports = router